using System.Collections.Generic;
using GameFramework;

namespace StarForce
{
    /// <summary>
    /// 方块消除命令
    /// </summary>
    public class EliminateCommand : IReference
    {
        /// <summary>
        /// 消除类型
        /// </summary>
        private EliminateType m_EliminateType;

        /// <summary>
        /// 消除的位置
        /// </summary>
        private List<int> m_Pos;

//        /// <summary>
//        /// 同时消除的其他横向命令
//        /// </summary>
//        private List<EliminateCommand> m_EliminateCommands;
//
//        public List<EliminateCommand> EliminateCommands
//        {
//            get { return m_EliminateCommands; }
//            set { m_EliminateCommands = value; }
//        }
//
        public EliminateType EliminateType
        {
            get { return m_EliminateType; }
            set { m_EliminateType = value; }
        }

        public List<int> Pos
        {
            get { return m_Pos; }
            set { m_Pos = value; }
        }

        public EliminateCommand Fill(EliminateType eliminateType)
        {
            m_EliminateType = eliminateType;
            m_Pos = new List<int>();
//            m_EliminateCommands = new List<EliminateCommand>();
            return this;
        }

        /// <summary>
        /// 添加一个消除位置
        /// </summary>
        /// <param name="pos"></param>
        public void AddPos(int pos)
        {
            m_Pos.Add(pos);
        }

        /// <summary>
        /// 添加消除位置
        /// </summary>
        /// <param name="pos"></param>
        public void AddPos(List<int> pos)
        {
            for (int i = 0; i < pos.Count; i++)
            {
                AddPos(pos[i]);
            }
        }
//
//        private void AddCommand(EliminateCommand eliminateCommand)
//        {
//            m_EliminateCommands.Add(eliminateCommand);
//        }


        public void Clear()
        {
            m_EliminateType = EliminateType.Unknow;
            m_Pos.Clear();
//            m_EliminateCommands.Clear();
        }
    }
}